package com.example.peibei.ui.adapter;

import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;
import com.bumptech.glide.request.RequestOptions;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.dingtao.common.bean.GetOrder;
import com.dingtao.common.bean.SearchResult;
import com.example.peibei.R;

import java.util.List;

public class GetOrderAdapter extends BaseQuickAdapter<GetOrder.RecordsDTO, BaseViewHolder> {

    private int status;
    public GetOrderAdapter(@Nullable List<GetOrder.RecordsDTO> data) {
        super(R.layout.item_order_get, data);
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Override
    protected void convert(BaseViewHolder helper, GetOrder.RecordsDTO item) {
        ImageView head = helper.getView(R.id.iv_head);
        Glide.with(getContext()).load(item.getImgUrl()).apply(RequestOptions.bitmapTransform(new CircleCrop())).into(head);
        helper.setText(R.id.tv_time, item.getDate()).setText(R.id.tv_name, item.getNickName()).setText(R.id.tv_address, item.getArea()).setText(R.id.tv_price, item.getPayPrice() + "")
                .setText(R.id.tv_dec, item.getOtherDesc()).setText(R.id.tv_category, item.getCategory());

        if (status == 4){
            helper.setGone(R.id.tv_cancel,false);
        }else {
            helper.setGone(R.id.tv_cancel,true);
        }
    }
}
